package com.create404.suishoupai.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.create404.suishoupai.dto.CommentedAnnouncementDto;
import com.create404.suishoupai.entity.AnnouncementComment;
import com.create404.suishoupai.vo.AnnouncementCommentListItemVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author create404
 * @since 2021-07-17
 */
public interface AnnouncementCommentMapper extends BaseMapper<AnnouncementComment> {


    /**
     * 获取公告评论列表
     *
     * @param announcementId
     * @return
     */
    @Select("SELECT announcement_comment.*, employee.`name`, employee.`avatar` FROM announcement_comment INNER JOIN employee ON announcement_comment.employee_id = employee.employee_id AND announcement_comment.announcement_id = #{announcementId}")
    List<AnnouncementCommentListItemVO> getAnnouncementCommentList(String announcementId);


    IPage<CommentedAnnouncementDto> getCommentedAnnouncement(Page<?> page, String employeeId);
}
